using System;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Xml;
using System.IO;
using System.Text.RegularExpressions;

using WPS.Libraries.CssDom;

namespace WPS.Modules.StyleLibrary
{
	/// <summary>
	/// Page for editing Heading styles (H1-H6) in the Style Library.
	/// </summary>
	public partial class HeadingEdit : StyleLibraryBasePage
	{
		#region Page events 

		protected new void Page_Load(object sender, System.EventArgs e)
		{
			this.CmsIntegration = new StyleLibraryIntegration();
			base.Page_Load(sender, e);
		}

		#endregion

		#region Private helper methods

		protected override bool ValidateForm()
		{
			return true;
		}

		/// <summary>
		/// Returns an array of StyleRuleSearch objects, with initialized for the related selectors.
		/// </summary>
		/// <param name="styleName">Style name to create search rules for (ignored for h1,h2...).</param>
		/// <returns>StyleRuleSearch array with SelectorText values set for the required css rules.</returns>
		protected override StyleRuleSearch[] GetRules(string styleName)
		{
			return new StyleRuleSearch[] {
				new StyleRuleSearch("h1"), 
				new StyleRuleSearch("h2"), 
				new StyleRuleSearch("h3"), 
				new StyleRuleSearch("h4"), 
				new StyleRuleSearch("h5"), 
				new StyleRuleSearch("h6") };
		}

		/// <summary>
		/// Return an array of selector strings with a new stlye names (currently same as simple h1,h2...).
		/// </summary>
		/// <param name="newName">New style name for selectors (Ignored for h1,h2...).</param>
		/// <returns>List of CSS selectors necessary for this style (quite static for h1,h2..).</returns>
		protected override string[] GetRenames(string newName)
		{
			string[] renames = {
					"h1", 
					"h2", 
					"h3", 
					"h4", 
					"h5", 
					"h6" };
			return renames;
		}

		/// <summary>
		/// Interface function from superclasses to our PageMessageControl.
		/// </summary>
		/// <param name="message">Message to send.</param>
		/// <param name="error">Message type.</param>
		protected override void SendPageMessage(string message, bool error)
		{
			pgmPageMessage.Send(message, error);
		}

		#endregion

		#region Child control init

		protected void btnSave_Init(object sender, EventArgs e)
		{
			btnSave.Attributes.Add("onclick", "updateDemo(); return true;");
		}

		#endregion
	}
}
